package com.imau.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * 监听应用的在线人数:
 * 不同客户端之间共享: * 应用级别的数据共享
 */
@WebListener
public class OnliCountServletContextListener implements ServletContextListener {

    public void contextInitialized(ServletContextEvent sce) {
        //设置一个属性:onLineCount = 0
        sce.getServletContext().setAttribute("count",0);
    }

    public void contextDestroyed(ServletContextEvent sce) {

    }
}
